package br.teste;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.ScrollPane;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;

public class Frame extends JFrame {
	JPanel p = null;
	JPanel p2 = null;
	ScrollPane scrollpane ;
	public Frame() {
		super("Teste");
		setSize(800, 600);
	    setDefaultCloseOperation(EXIT_ON_CLOSE);
	    init();
	    setVisible(true);		
	}
	
	public void init() {
		p = new JPanel(new BorderLayout());
	    p.setSize(getWidth(), getHeight());
	    //p.setLayout(new GridLayout(13, 6, 10, 0));

	    p2 = new JPanel();
	    p2.setPreferredSize(new Dimension(600,1000));

	    p.add(p2);
        p.setBackground(Color.red);
	    p2.addMouseListener(mouse);
	    //p.setSize(600, 400);
	    scrollpane = new ScrollPane();
	    scrollpane.setBounds(0, 0, 600,800);
	    scrollpane.add(p);
	    getContentPane().add(scrollpane, BorderLayout.CENTER);
	  }
	
	MouseAdapter mouse = new MouseAdapter() {
		public void mousePressed(MouseEvent arg0) {
	         p2.setPreferredSize(new Dimension(1000, 1000));
	         p2.revalidate();
		};
	};
}

